﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace DataLayer
{
    [KnownType(typeof(Actor))]
    [DataContract(IsReference=true)]
    public class Movie
    {
        private string _title;
        private string _genre;
        private string _time;
        private string _description;
        private double _price;
        private List<Actor> _actors;

        public Movie(string title, string genre, string time, string description, double price, List<Actor> actors)
        {
            SetValues(title, genre, time, description, price, actors);
        }

        public Movie(string title, string genre, string time, string description, double price)
        {
            SetValues(title, genre, time, description, price, null);
        }

        public Movie(string title, string genre, string time, string description)
        {
            SetValues(title, genre, time, description, 0.0, null);
        }

        public Movie(string title, string genre, string time)
        {
            SetValues(title, genre, time, "", 0.0, null);
        }

        public Movie(string title, string genre)
        {
            SetValues(title, genre, "", "", 0.0, null);
        }

        public Movie(string title)
        {
            SetValues(title, "", "", "", 0.0, null);
        }

        public Movie()
        {
            SetValues("", "", "", "", 0.0, null);
        }

        private void SetValues(string title, string genre, string time, string description, double price, List<Actor> actors)
        {
            _title = title;
            _genre = genre;
            _time = time;
            _description = description;
            _price = price;
            _actors = actors;
        }

        [DataMember]
        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }

        [DataMember]
        public string Genre
        {
            get { return _genre; }
            set { _genre = value; }
        }

        [DataMember]
        public string Time
        {
            get { return _time; }
            set { _time = value; }
        }

        [DataMember]
        public string Description
        {
            get { return _description; }
            set { _description = value; }
        }

        [DataMember]
        public double Price
        {
            get { return _price; }
            set { _price = value; }
        }

        [DataMember]
        public List<Actor> Actors
        {
            get { return _actors; }
            set { _actors = value; }
        }
    }
}
